﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using AvalonDock;

using FXnaGis;

using FXnaInfrastructure;

using NSApplication;


namespace NSPresentation
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //我们暂时这样设置一下

            this.DataContext = AppViewModel.Current;



            CommandService.CurrentService.BindCommandsToWindow(this);

            CommandService.CurrentService.BindKeyToWindow(this);



            //完成一些界面的初始化

            FMap map = this.wfhGis.Child as FMap;


            GisService.CurrentService.CurrentMap = map;

           



            //需要做一些基本的设置,这里我们只是为了方便测试

            map.MouseMove += new System.Windows.Forms.MouseEventHandler(map_MouseMove);




           



            



        }



       


        void map_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            FMap map = this.wfhGis.Child as FMap;

            DotSpatial.Topology.Coordinate c = map.GeoMapFrame.BufferToProj(e.Location);

            lblCoordX.Content = "X:" + c.X.ToString("F02");

            lblCoordY.Content = "Y:" + c.Y.ToString("F02");

        }
    }
}
